Setting the Pool Size
You set the initial size of the memory pool in the control panel. If the default setting for the Subsystem is to use local memory by default, RTSS applications and the RTX64 Subsystem will use the local pool for all allocations unless you specifically override this when launching a process. If Request from Windows is selected, only applications configured to run using local memory will allocate memory from the local pool.
NOTE: Make sure you create a memory pool that is big enough for your application and the Subsystem's memory needs. If the pool does not have enough memory to handle your request, your allocation will fail or a non-deterministic call will be made to acquire more memory.
The RTX64 Subsystem local memory pool logic can be configured in two ways. When the pool does not have enough memory to fulfill your allocation request, the Subsystem can:
- Fail the call with and error that not enough memory is available.
- Make a non-deterministic call requesting more memory from Windows. The size of memory requested will be based on a preset expand by size.
Regardless of the Subsystem default setting for the local memory, you can monitor the size of the local memory pool using RtQueryLocalMemory and expand the pool by using RtExpandLocalMemory. Instead of waiting until the pool memory is fully depleted, you can force the expansion of the local memory pool. This allows you to decide when to handle a non-deterministic call within your application.
NOTE: You cannot request additional memory from Windows from within a shutdown handler.
NOTE: When allocating a small chunk of memory, we recommend you use the function RtAllocateLocalMemory instead of malloc.
If local memory pool usage is enabled, all the memory allocations explicitly or implicitly in the RTSS application are allocated from local memory pool. As a result, the following functions become deterministic and can be called in the shutdown handler.
CreateThread* The stack has no guard page for the thread created in the local memory pool. |
||